package com.fr.chart.shape3d;

import com.fr.base.core.json.JSONException;
import com.fr.base.core.json.JSONObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.chart.ColorInfo;
import com.fr.chart.math.Projection;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Shape;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.util.List;

public class Area3D extends FoldLine3D
{
  private static final long serialVersionUID = 4316089814981343932L;
  public static final String XML_TAG = "Area3D";

  public Area3D()
  {
  }

  public Area3D(float paramFloat1, float paramFloat2)
  {
    super(paramFloat1, paramFloat2);
  }

  public Area3D(double paramDouble1, double paramDouble2)
  {
    super(paramDouble1, paramDouble2);
  }

  public void draw(Graphics paramGraphics)
  {
    super.draw(paramGraphics);
    Color localColor = null;
    if ((getColorInfo() != null) && (getColorInfo().getSeriesColor() != null))
    {
      localColor = getColorInfo().getSeriesColor();
      getColorInfo().setSeriesColor(localColor.brighter());
    }
    getColorInfo().paint(paramGraphics, getFrontArea());
    if (localColor != null)
      getColorInfo().setSeriesColor(localColor);
  }

  private GeneralPath getFrontArea()
  {
    GeneralPath localGeneralPath = new GeneralPath();
    for (int i = 0; i < getPoint_list().size(); ++i)
    {
      Point2D localPoint2D = getProjection().projectee(((Point2D)getPoint_list().get(i)).getX(), ((Point2D)getPoint_list().get(i)).getY(), getZ());
      if (i == 0)
        localGeneralPath.moveTo((float)localPoint2D.getX(), (float)localPoint2D.getY());
      else
        localGeneralPath.lineTo((float)localPoint2D.getX(), (float)localPoint2D.getY());
    }
    localGeneralPath.closePath();
    return localGeneralPath;
  }

  public Shape getShape()
  {
    GeneralPath localGeneralPath = getFrontArea();
    localGeneralPath.append(super.getShape(), false);
    return localGeneralPath;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("Area3D");
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.end();
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Area3D))
      return false;
    Area3D localArea3D = (Area3D)paramObject;
    return (super.equals(localArea3D));
  }

  public JSONObject toJSONOjbect()
    throws JSONException
  {
    JSONObject localJSONObject = super.toJSONObject();
    return localJSONObject;
  }
}